package com.twu.biblioteca.actions;

import com.twu.biblioteca.controllers.UserController;

import java.util.Scanner;

public class Authenticate implements Action {
    private UserController userController;
    private Scanner scanner;

    public Authenticate(UserController userController, Scanner scanner) {
        this.userController = userController;
    }

    @Override
    public String displayName() {
        return "Sing in";
    }

    @Override
    public void perform() {
        System.out.print("Login: ");

        scanner = new Scanner(System.in);
        String login = scanner.nextLine();

        System.out.println();
        System.out.print("Password: ");

        String password = scanner.nextLine();

        System.out.println();
        System.out.println(userController.authenticate(login, password));
    }
}
